package com.training.thread.section01;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class MyThread03 implements Callable<Integer> {

	@Override
	public Integer call() throws Exception {
		int s = 0;
		for(int i = 0;i<=100;i++) {
			s+=i;
		}
		return s;
	}
	public static void main(String[] args) throws Exception{
		FutureTask<Integer> ft  = new FutureTask<>(new MyThread03());
		ft.run();
		System.out.println("result:"+ft.get());
	}
}
